#include <iostream>

using namespace std;

class Watch {
	public:
		Watch() : m_hour(0), m_min(0), m_sec(0) {}
		Watch run();
		Watch operator++(); // 前置++
		Watch operator++(int s); // 后置++
		friend ostream &operator<<(ostream &out, const Watch &w);
	private:
		int m_hour;
		int m_min;
		int m_sec;
};

Watch Watch::run()
{
	this->m_sec++;
	while (m_sec >= 60) {
		m_min++;
		m_sec -= 60;
	}
	while (m_min >= 60) {
		m_hour++;
		m_min -= 60;
	}
	return *this;
}

Watch Watch::operator++()
{
	run();
	return *this;
}

Watch Watch::operator++(int s)
{		
	Watch w = *this;
	run();

	return w;
}

ostream &operator<<(ostream &out, const Watch &w)
{
	out << w.m_hour << ":" << w.m_min << ":" << w.m_sec;
	return out;
}

int main(void)
{
	Watch w1, w2;
	int i;

	for (i = 0; i < 10000; i++) {
		w1++;
	}
	cout << w1 << endl;
	
	w2 = w1++;
	cout << w1 << endl;
	cout << w2 << endl;

	w2 = ++w1;
	cout << w1 << endl;
	cout << w2 << endl;

	return 0;
}

